<script>
$(function() {
	$('select#passenger_type').val('<?php echo $passenger['passenger_type'];?>');
	handle_field_by_passenger_type($('select#passenger_type').val());
	$('select#certification_type').val('<?php echo $passenger['certification_type'];?>');

	$('select#passenger_type').change(function() {
		handle_field_by_passenger_type($(this).val());
	});

	function handle_field_by_passenger_type(type_id) {
		if (type_id == 'I') {
			$('#certification_type').attr('disabled', '');
			$('#certification_number').attr('disabled', '');
		} else {
			$('#certification_type').removeAttr('disabled');
			$('#certification_number').removeAttr('disabled');
		}
	}
});
</script>
<div class="well">
	<blockquote>
		<h3 class="text-error">My Page - Edit Passenger Information</h3>
	</blockquote>
	<form class="form-horizontal" id="my_page_passenger_edit_block">
		<input type="hidden" name="id" value="<?php echo $passenger['id'];?>">
		<div class="control-group">
			<label class="control-label">Pasenger Name</label>
			<div class="controls">
				<input type="text" name="passenger_name" value="<?php echo $passenger['passenger_name'];?>">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Passenger Type</label>
			<div class="controls">
				<select id="passenger_type" name="passenger_type">
					<option value="A">Adult</option>
					<option value="C">Child</option>
					<option value="I">Infant</option>
				</select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Certification Type</label>
			<div class="controls">
				<select id="certification_type" name="certification_type">
					<option value="1">Identification Card</option>
					<option value="2">Officer Certificate</option>
				</select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Certification Number</label>
			<div class="controls">
				<input type="text" id="certification_number" name="certification_number" value="<?php echo $passenger['certification_number'];?>">
			</div>
		</div>
		
		<div class="control-group">
			<div class="controls">
				<button type="button" class="btn btn-success" id="save">Save</button>
			</div>
		</div>
		
		<button type="button" class="btn btn-small btn-info" id="view_passengers">View common used passengers</button>
	</form>
</div>
